//
//  shader.h
//  RenderV1
//
//  Created by 黄翔 on 2019/8/20.
//  Copyright © 2019 黄翔. All rights reserved.
//

#ifndef Shader_h
#define Shader_h

#include <string>
#include "HMath.h"
#include "ReferenceCounted.h"

namespace hxe {
    class Shader : public ReferenceCounted
    {
    public:
        unsigned int id;

        Shader(const std::string &vertexPath, const std::string &fragmentPath);
        ~Shader();
        
        void use();

        void setBool(const std::string &name, bool value) const;

        void setInt(const std::string &name, int value) const;

        void setFloat(const std::string &name, float value) const;
        
        void setVector4(const std::string &name, float x, float y, float z, float w) const;

        void setVector4(const std::string &name, const Vector4& v) const;
        
        void setVector3(const std::string &name, float x, float y, float z) const;

        void setVector3(const std::string &name, const Vector3& v) const;
        
        void setMatrix(const std::string &name, const Matrix4x4 &matrix) const;
    private:
        void checkCompileErrors(unsigned int shader, std::string type);
    };
}
#endif /* Shader_h */
